package com.linzm.creationaltype.abstractfactory02.factory;

import com.linzm.creationaltype.abstractfactory02.enums.FactoryTypeEnum;
import com.linzm.creationaltype.abstractfactory02.enums.TypeInterface;

/**
 * @Author zimingl
 * @Date 2023/4/15 19:46
 * @Description: FactoryProducer
 */
public class FactoryProducer {
    public static AbstractFactory getFactory(String choice) throws Exception {
        TypeInterface shapeTypeEnum = FactoryTypeEnum.valueOf(choice);
        Class<?> clazz = shapeTypeEnum.getClazz();
        return (AbstractFactory) clazz.newInstance();
    }
}
